<?php
//////////////////////////////////////////////////
/////////////// Main Game script /////////////////
//////////////////////////////////////////////////

require_once('lib_load.php');
load_lib(array('DbMysql', 'User', 'Player'));

$player = new Player();

$player->Refresh(); //security check
//$player->move(4,1);
/*
$player->CreateOutput();
    $player->PutWeight(3, 5);
    $field = $player->GetBuf();
    $player->PutWay($player->GetPlayerScreenX(), $player->GetPlayerScreenY(), $player->GetPlayerWeight()-1);
    $player->PutPlayer();
    $player->PutOthers();
    $view =  $player->GetOutput();*/
    /*
    $player->CreateOutput();
    $player->PutWeight(1,1);//$_POST['x'], $_POST['y']);
    $field = $player->GetBuf();
    for ($y = 0; $y <= 8; $y++)
    {
        for ($x = 0; $x <=8; $x++)
        {
            if ($x == 8) echo $field[$x][$y]."<br>";
            else echo $field[$x][$y];
        }
    }
    echo $player->GetPlayerWeight().$player->GetPlayerScreenX().$player->GetPlayerScreenY();
    echo $player->PutWay($player->GetPlayerScreenX(), $player->GetPlayerScreenY(), $player->GetPlayerWeight());
    $player->PutPlayer();
    $player->PutOthers();
    $view = $player->GetOutput();*/

$player->CreateOutput();

$player->PutPlayer();
$player->PutOthers();
$view = $player->GetOutput();

    // Loadfing the infomation in main_buffer

    $main_buf = implode('',file('templates/data/main/main.htm'));
    $main_buf=str_replace("[%MAP_OUTPUT%]",$view ,$main_buf);

    // main info output
    echo $main_buf;



?>
